<html>
<head><meta charset="utf-8"><title>Type mismatch in tied operands · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html">Type mismatch in tied operands</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="189228368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189228368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189228368">(Feb 27 2020 at 16:17)</a>:</h4>
<p>It seems that LLVM's register allocator can't handle tied operands where the input and output types differ.</p>



<a name="189228477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189228477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189228477">(Feb 27 2020 at 16:18)</a>:</h4>
<p>Clang hides this a bit by adding zero-extensions when both types are integers or pointers.</p>



<a name="189228496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189228496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189228496">(Feb 27 2020 at 16:18)</a>:</h4>
<p>But for all other type combinations, it produces an error.</p>



<a name="189228639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189228639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189228639">(Feb 27 2020 at 16:20)</a>:</h4>
<p>This is purely an LLVM limitation, GCC handles different types just fine.</p>



<a name="189228657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189228657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189228657">(Feb 27 2020 at 16:20)</a>:</h4>
<p>And so would our theoretical external assembler fallback.</p>



<a name="189228687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189228687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189228687">(Feb 27 2020 at 16:21)</a>:</h4>
<p>The question is: do we want to provide the same implicit conversion for integers that Clang does?</p>



<a name="189228842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189228842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189228842">(Feb 27 2020 at 16:23)</a>:</h4>
<p>I'm tending towards no, since unlike Clang we don't have to emulate GCC's behavior. We can just force users to provide the casts where needed.</p>



<a name="189272971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/Type%20mismatch%20in%20tied%20operands/near/189272971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/Type.20mismatch.20in.20tied.20operands.html#189272971">(Feb 28 2020 at 00:35)</a>:</h4>
<p>Yeah, that seems acceptable. It would be confusing even if it worked.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>